﻿using System;

namespace Ayatta.Contract.Domain
{
    public class Refund : Versionable<string>
    {
        /// <summary>
        /// 退款类型 仅退款/退货退款
        /// </summary>
        public string Category { get; set; }
        /// <summary>
        /// 订单号
        /// </summary>
        public string OrderId { get; set; }

        /// <summary>
        /// 子订单号
        /// </summary>
        public string OrderItemId { get; set; }

        /// <summary>
        /// 订单总金额
        /// </summary>
        public decimal Total { get; set; }

        /// <summary>
        /// 退还金额(退还给买家的金额)
        /// </summary>
        public decimal Return { get; set; }

        /// <summary>
        /// 支付给商家的金额(交易总金额-退还给买家的金额)
        /// </summary>
        public decimal Payment { get; set; }

        /// <summary>
        /// 买家Id
        /// </summary>
        public int BuyerId { get; set; }

        /// <summary>
        /// 买家昵称
        /// </summary>
        public string BuyerNick { get; set; }

        /// <summary>
        /// 卖家Id
        /// </summary>
        public int SellerId { get; set; }

        /// <summary>
        /// 卖家昵称
        /// </summary>
        public string SellerNick { get; set; }

        /// <summary>
        /// SkuId
        /// </summary>
        public int SkuId { get; set; }

        /// <summary>
        /// 商品Id
        /// </summary>
        public int ItemId { get; set; }

        /// <summary>
        /// 商品标题
        /// </summary>
        public string ItemTitle { get; set; }

        /// <summary>
        /// 商品图片Url
        /// </summary>
        public string ItemPicture { get; set; }

        /// <summary>
        /// 属于这个sku的商品的数量
        /// </summary>
        public int Quantity { get; set; }

        /// <summary>
        /// 属于这个sku的商品的价格
        /// </summary>
        public decimal Price { get; set; }

        /// <summary>
        /// 退款原因Id
        /// </summary>
        public int ReasonId { get; set; }

        /// <summary>
        /// 退款原因
        /// </summary>
        public string Reason { get; set; }

        /// <summary>
        /// 退款说明
        /// </summary>
        public string Desc { get; set; }

        /// <summary>
        /// 凭证图片
        /// </summary>
        public string Attachments { get; set; }

        /// <summary>
        /// 买家是否需要退货。可选值:true(是),false(否)
        /// </summary>
        public bool GoodsReturn { get; set; }

        /// <summary>
        /// 退货时间。格式:yyyy-MM-dd HH:mm:ss
        /// </summary>
        public DateTime? GoodsReturnTime { get; set; }

        /// <summary>
        /// 货物状态。可选值 BuyerNotReceived (买家未收到货) BuyerReceived (买家已收到货) BuyerReturned (买家已退货)
        /// </summary>
        public string GoodsStatus { get; set; }

        /// <summary>
        /// 物流订单Id
        /// </summary>
        public string ShippingId { get; set; }

        /// <summary>
        /// 卖家收货地址
        /// </summary>
        public string RefundAddress { get; set; }

        /// <summary>
        /// 物流公司名称
        /// </summary>
        public string ShippingCompany { get; set; }

        /// <summary>
        /// 运单号
        /// </summary>
        public string ExpressNo { get; set; }

        /// <summary>
        /// 退款超时
        /// </summary>
        public DateTime? Timeout { get; set; }

        /// <summary>
        /// 扩展信息
        /// </summary>
        public string Extra { get; set; }


        /// <summary>
        /// 退款状态
        /// </summary>
        public RefundStatus Status { get; set; }

        /// <summary>
        /// 最后一次更新时间
        /// </summary>
        public DateTime ModifiedOn { get; set; }
    }

    /// <summary>
    /// 退款状态
    /// </summary>
    public enum RefundStatus : byte
    {
        /// <summary>
        /// 买家已经申请退款，等待卖家同意
        /// </summary>
        WaitSellerAgree = 0,
        /// <summary>
        /// 卖家已经同意退款，等待买家退货
        /// </summary>
        WaitBuyerReturnGoods = 1,
        /// <summary>
        /// 买家已经退货，等待卖家确认收货
        /// </summary>
        WaitSellerConfirmGoods = 2,
        /// <summary>
        /// 卖家拒绝退款
        /// </summary>
        SellerRefuseBuyer = 3,
        /// <summary>
        /// 退款关闭
        /// </summary>
        Closed = 4,
        /// <summary>
        /// 退款成功
        /// </summary>
        Success = 5
    
    }
}